Fix leaks of results of gtk_container_get_children(). (#68199, Damon
authorOwen Taylor <otaylor@redhat.com>
Tue, 8 Jan 2002 19:44:34 +0000 (19:44 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 8 Jan 2002 19:44:34 +0000 (19:44 +0000)
Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>

* gtk/gtktoolbar.c: Fix leaks of results of
gtk_container_get_children(). (#68199, Damon Chaplin)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktoolbar.c

index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index ced0d903b8c8db670e43c49a41a0b58079c97a67..08ad67acfc905b73a14c51b0a1f3955575b5f104 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan  8 14:42:19 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktoolbar.c: Fix leaks of results of
+       gtk_container_get_children(). (#68199, Damon Chaplin.)
+
 Tue Jan  8 14:19:43 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): 
index 916f359a1ef0bbfd71206fd5ef2badc0a694b51d..9c9b3fe76c7333c30e0eed350fe806ec2b9e5a20 100644 (file)
@@ -1602,6 +1602,16 @@ gtk_real_toolbar_orientation_changed (GtkToolbar     *toolbar,
     }
 }
 
+static GtkWidget *
+get_first_child (GtkContainer *container)
+{
+  GList *children = gtk_container_get_children (children);
+  GtkWidget *result = children ? children->data : NULL;
+  g_list_free (children);
+  
+  return result;
+}
+
 static void
 gtk_real_toolbar_style_changed (GtkToolbar      *toolbar,
                                GtkToolbarStyle  style)
@@ -1650,7 +1660,7 @@ gtk_real_toolbar_style_changed (GtkToolbar      *toolbar,
                if (child->label && !GTK_WIDGET_VISIBLE (child->label))
                  gtk_widget_show (child->label);
 
-               box = (GtkWidget*)gtk_container_get_children (GTK_CONTAINER (child->widget))->data;
+               box = get_first_child (GTK_CONTAINER (child->widget));
 
                if (GTK_IS_HBOX (box))
                {
@@ -1694,7 +1704,7 @@ gtk_real_toolbar_style_changed (GtkToolbar      *toolbar,
                if (child->label && !GTK_WIDGET_VISIBLE (child->label))
                  gtk_widget_show (child->label);
 
-               box = (GtkWidget*)gtk_container_get_children (GTK_CONTAINER (child->widget))->data;
+               box = get_first_child (GTK_CONTAINER (child->widget));
                
                if (GTK_IS_VBOX (box))
                {